package com.finesys.backend.api.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * @author lehoon
 *
 * <p>Description: restclient</p>
 * 
 * 2020年10月12日
 */
@Configuration
public class RestClientConfig {

	@Bean
	public RestTemplate getRestTemplate(ClientHttpRequestFactory factory){
		return new RestTemplate(factory);
	}
	
	@Bean
	public ClientHttpRequestFactory getSimpleClientHttpRequestFactory(){
		SimpleClientHttpRequestFactory fac = new SimpleClientHttpRequestFactory();
	    fac.setReadTimeout(5000); 
	    fac.setConnectTimeout(15000);
	    return fac;
	}
}
